<?php
/**
 * MySqlConnection
 * Mysql connection abstract classes.
 *
 * @author Lim Afriyadi
 * @version pre-alpha
 * @package Samble
 * @subpackage db
 * @license GNU/GPL
 */
abstract class MySqlConnection
{
    /**
     * Hostname of mysql server
     * @var string
     */
    var $s_Host = "";
    /**
     * Mysql server socket path
     * @var string
     */
    var $s_Socket_Path = "";
    /**
     * Mysql server network port
     * @var int
     */
    var $i_Port = 3306;
    /**
     * Mysql server socket connection state
     * @var boolean
     */
    var $b_Socket = false;
    /**
     * Mysql server username
     * @var string
     */
    var $s_Uname = "";
    /**
     * Mysql server password
     * @var string
     */
    var $s_Pwd = "";
    /**
     * Mysql database name
     * @var string
     */
    var $s_Db = "";
    /**
     * Mysql persistent connection state
     * @var boolean
     */
    var $b_Persistent = false;
    /**
     * Mysql connection state
     * @var boolean
     */
    var $b_State= false;

    /**
     * Abstract mysql connection function. All parameters are mandatory.
     * @param string $s_Host
     * @param int $i_Port
     * @param string $s_Uname
     * @param string $s_Pwd
     * @param string $s_Db
     * @return boolean
     */
    abstract function connect( $s_Host="",$i_Port="",$s_Uname="",$s_Pwd="",$s_Db="" );
    /**
     * Abstract mysql persistent connection function. All parameters are mandatory.
     * @param string $s_Host
     * @param int $i_Port
     * @param string $s_Uname
     * @param string $s_Pwd
     * @param string $s_Db
     * @param boolean $b_Persistent
     * @return boolean
     */
    abstract function pconnect( $s_Host="",$i_Port="",$s_Uname="",$s_Pwd="",$s_Db="",$b_Persistent=true );
    /**
     * Abstract mysql socket connection function. All parameters are mandatory.
     * @param string $sPath
     * @param string $s_Uname
     * @param string $s_Pwd
     * @param string $s_Db
     * @return boolean
     */
    abstract function sock( $sPath="",$s_Uname="",$s_Pwd="",$s_Db="" );
    /**
     * Abstract mysql socket persistent connection function. All parameters are mandatory.
     * @param string $sPath
     * @param string $s_Uname
     * @param string $s_Pwd
     * @param string $s_Db
     * @param boolean $b_Persistent
     * @return boolean
     */
    abstract function psock( $sPath="",$s_Uname="",$s_Pwd="",$s_Db="",$b_Persistent=true );
    /**
     * Abstract function to check mysql state.
     * @return boolean
     */
    abstract function isConnected();
    /**
     * Abstract function to disconnect from mysql server.
     * @return boolean
     */
    abstract function disconnect();
}
?>
